/**
 * @author Joshua Sullivan
 */
class RectangleDrawer {
	
	/**
	 * Draws a rectangle into the seleceted MovieClip.
	 * 
	 * @param mc: The clip to draw into.
	 * @param x: The x position of the rectangle within the clip.
	 * @param y: The y position of the rectangle within the clip.
	 * @param width: The width of the rectangle.
	 * @param height: The height of the rectangle.
	 * @param fillColor: The fill color of the rectangle. If null is passed, no fill will be created.
	 * @param strokeColor: The color of the stroke around the rectangle. Values of null or undefined result in no stroke.
	 * @param strokeWidth: The width of the stroke.
	 */
	public static function draw (mc:MovieClip, x:Number, y:Number, width:Number, height:Number, fillColor:Number, strokeColor:Number, strokeWidth:Number) : Void {
		if (typeof(fillColor) == "number" && fillColor != Number.NaN) {
			mc.beginFill(Math.max(fillColor, 0), 100);
		}
		if (typeof(strokeColor) == "number" && strokeColor != Number.NaN) {
			var sw:Number = 0;
			if (typeof(strokeWidth) == "number" && strokeWidth != Number.NaN) {
				sw = strokeWidth;
			}
			mc.lineStyle(sw, strokeColor, 100, true);
		}
		mc.moveTo(x,y);
		mc.lineTo(x + width, y);
		mc.lineTo(x + width, y + height);
		mc.lineTo(x, y + height);
		mc.lineTo(x, y);
		mc.endFill();
	}
}